 package tools.packet;

 import client.MapleCharacter;
import client.status.MonsterStatus;
import client.status.MonsterStatusEffect;
import client.status.NewMonsterStatusEffect;
import handling.Buffstat;
import handling.opcode.BossEffectOpcode;
import handling.opcode.SendPacketOpcode;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import server.life.MapleMonster;
import server.life.MobSkill;
import server.maps.MapleMap;
import server.maps.MapleNodes;
import server.maps.MapleSwordNode;
import server.movement.LifeMovementFragment;
import tools.DateUtil;
import tools.Pair;
import tools.Randomizer;
import tools.data.output.MaplePacketLittleEndianWriter;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.stream.Collectors;
































 public class MobPacket
 {
/*   37 */   private static final Logger log = LogManager.getLogger(MobPacket.class);




   public static byte[] damageMonster(int oid, long damage) {
/*   43 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/*   44 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*   46 */     mplew.writeShort(SendPacketOpcode.DAMAGE_MONSTER.getValue());
/*   47 */     mplew.writeInt(oid);
/*   48 */     mplew.write(0);
/*   49 */     if (damage > 2147483647L) {
/*   50 */       mplew.writeInt(2147483647);
     } else {
/*   52 */       mplew.writeInt((int)damage);
     }

/*   55 */     return mplew.getPacket();
   }




   public static byte[] damageFriendlyMob(MapleMonster mob, long damage, boolean display) {
/*   62 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/*   63 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*   65 */     mplew.writeShort(SendPacketOpcode.DAMAGE_MONSTER.getValue());
/*   66 */     mplew.writeInt(mob.getObjectId());
/*   67 */     mplew.write(display ? 1 : 2);
/*   68 */     if (damage > 2147483647L) {
/*   69 */       mplew.writeInt(2147483647);
     } else {
/*   71 */       mplew.writeInt((int)damage);
     }
/*   73 */     if (mob.getHp() > 2147483647L) {
/*   74 */       mplew.writeInt((int)(mob.getHp() / mob.getMobMaxHp() * 2.147483647E9D));
     } else {
/*   76 */       mplew.writeInt((int)mob.getHp());
     }
/*   78 */     if (mob.getMobMaxHp() > 2147483647L) {
/*   79 */       mplew.writeInt(2147483647);
     } else {
/*   81 */       mplew.writeInt((int)mob.getMobMaxHp());
     }

/*   84 */     return mplew.getPacket();
   }




   public static byte[] killMonster(int oid, int animation) {
/*   91 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*   93 */     mplew.writeShort(SendPacketOpcode.KILL_MONSTER.getValue());
/*   94 */     mplew.writeInt(oid);
/*   95 */     mplew.write(animation);
/*   96 */     switch (animation) {
       case 0:
       case 1:
       case 5:
       case 6:
       case 7:
       case 8:
       case 10:
/*  104 */         mplew.writeInt(0);
         break;
       case 9:
/*  107 */         mplew.writeInt(0);
/*  108 */         mplew.writeInt(-1);
         break;
     }




/*  115 */     mplew.writeInt(0);
/*  116 */     return mplew.getPacket();
   }


















   public static byte[] healMonster(int oid, int heal) {
/*  137 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/*  138 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  140 */     mplew.writeShort(SendPacketOpcode.DAMAGE_MONSTER.getValue());
/*  141 */     mplew.writeInt(oid);
/*  142 */     mplew.write(0);
/*  143 */     mplew.writeInt(-heal);

/*  145 */     return mplew.getPacket();
   }




   public static byte[] showMonsterHP(int oid, int remhppercentage) {
/*  152 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  154 */     mplew.writeShort(SendPacketOpcode.SHOW_MONSTER_HP.getValue());
/*  155 */     mplew.writeInt(oid);
/*  156 */     mplew.write(remhppercentage);
/*  157 */     mplew.writeInt(0);

/*  159 */     return mplew.getPacket();
   }




   public static byte[] showBossHP(MapleMonster mob) {
/*  166 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  168 */     mplew.writeShort(SendPacketOpcode.BOSS_ENV.getValue());
/*  169 */     mplew.write(BossEffectOpcode.MobHPTag.getValue());
/*  170 */     mplew.writeInt((mob.getId() == 9400589) ? 9300184 : mob.getId());
/*  171 */     mplew.writeLong((long)(mob.getHp() / mob.getMobMaxHp() * 2.147483647E9D));
/*  172 */     mplew.writeLong(2147483647L);
/*  173 */     mplew.write(mob.getStats().getTagColor());
/*  174 */     mplew.write(mob.getStats().getTagBgColor());

/*  176 */     return mplew.getPacket();
   }







   public static byte[] showBossHP(int monsterId, long currentHp, long maxHp) {
/*  186 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  188 */     mplew.writeShort(SendPacketOpcode.BOSS_ENV.getValue());
/*  189 */     mplew.write(BossEffectOpcode.MobHPTag.getValue());
/*  190 */     mplew.writeInt(monsterId);
/*  191 */     mplew.writeLong((long)(currentHp / maxHp * 2.147483647E9D));
/*  192 */     mplew.writeLong(2147483647L);
/*  193 */     mplew.write(6);
/*  194 */     mplew.write(5);



/*  198 */     return mplew.getPacket();
   }










   public static byte[] moveMonsterResponse(int objectid, short moveid, int currentMp, boolean useSkills) {
/*  211 */     return moveMonsterResponse(objectid, moveid, currentMp, useSkills, 0, 0);
   }












   public static byte[] moveMonsterResponse(int objectid, short moveid, int currentMp, boolean useSkills, int skillId, int skillLevel) {
/*  226 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(19);

/*  228 */     mplew.writeShort(SendPacketOpcode.MOVE_MONSTER_RESPONSE.getValue());
/*  229 */     mplew.writeInt(objectid);
/*  230 */     mplew.writeShort(moveid);
/*  231 */     mplew.writeBool(useSkills);
/*  232 */     mplew.writeInt(currentMp);
/*  233 */     mplew.writeInt(skillId);
/*  234 */     mplew.writeShort(skillLevel);
/*  235 */     mplew.writeInt(Randomizer.rand(0, 16));
/*  236 */     mplew.writeInt(skillId);


/*  239 */     return mplew.getPacket();
   }

   public static byte[] moveMonsterResponse(int objectid, short moveid, int currentMp, boolean useSkills, int skillId, int skillLevel, int attackIdx) {
/*  243 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(19);

/*  245 */     mplew.writeShort(SendPacketOpcode.MOVE_MONSTER_RESPONSE.getValue());
/*  246 */     mplew.writeInt(objectid);
/*  247 */     mplew.writeShort(moveid);
/*  248 */     mplew.write(useSkills ? 1 : 0);
/*  249 */     mplew.writeInt(currentMp);
/*  250 */     mplew.writeInt(skillId);
/*  251 */     mplew.writeShort(skillLevel);
/*  252 */     mplew.writeInt(attackIdx);
/*  253 */     mplew.writeInt(skillId);

/*  255 */     return mplew.getPacket();
   }





































   public static byte[] moveMonster(boolean useskill, int skill, int skillid, int skilllevel, int oid, int v169, int tEncodedGatherDuration, int effectAfter, int unk, Point startPos, Point velPos, List<LifeMovementFragment> moves, List<Pair<Short, Short>> multiTargetForBall, List<Short> randTimeForAreaAttack, List<Integer> unkList) {
/*  295 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  297 */     mplew.writeShort(SendPacketOpcode.MOVE_MONSTER.getValue());
/*  298 */     mplew.writeInt(oid);
/*  299 */     mplew.writeBool(useskill);
/*  300 */     mplew.write(skill);

/*  302 */     mplew.writeShort(skillid);
/*  303 */     mplew.writeShort(skilllevel);



/*  307 */     mplew.writeShort(effectAfter);
/*  308 */     mplew.writeShort(unk);

/*  310 */     mplew.write(multiTargetForBall.size()); int i;
/*  311 */     for (i = 0; i < multiTargetForBall.size(); i++) {
/*  312 */       mplew.writeShort(((Short)((Pair)multiTargetForBall.get(i)).left).shortValue());
/*  313 */       mplew.writeShort(((Short)((Pair)multiTargetForBall.get(i)).right).shortValue());
     }

/*  316 */     mplew.write(randTimeForAreaAttack.size());
/*  317 */     for (i = 0; i < randTimeForAreaAttack.size(); i++) {
/*  318 */       mplew.writeShort(((Short)randTimeForAreaAttack.get(i)).shortValue());
     }

/*  321 */     mplew.write(unkList.size());
/*  322 */     for (i = 0; i < unkList.size(); i++) {
/*  323 */       mplew.writeInt(((Integer)unkList.get(i)).intValue());
     }

/*  326 */     PacketHelper.serializeMovementList(mplew, v169, tEncodedGatherDuration, startPos, velPos, moves);
/*  327 */     mplew.write(0);

/*  329 */     return mplew.getPacket();
   }

   public static byte[] moveMonster(byte useskill, int actionAndDir, int skillid, int skilllevel, int oid, int v169, int tEncodedGatherDuration, int effectAfter, int unk, int unkV170, Point startPos, Point velPos, List<LifeMovementFragment> moves, List<Pair<Short, Short>> multiTargetForBall, List<Short> randTimeForAreaAttack, List<Integer> unkList) {
/*  333 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  335 */     mplew.writeShort(SendPacketOpcode.MOVE_MONSTER.getValue());
/*  336 */     mplew.writeInt(oid);
/*  337 */     mplew.write(useskill);
/*  338 */     mplew.write(actionAndDir);

/*  340 */     mplew.writeShort(skillid);
/*  341 */     mplew.writeShort(skilllevel);



/*  345 */     mplew.writeShort(effectAfter);
/*  346 */     mplew.writeShort(unk);

/*  348 */     mplew.write(multiTargetForBall.size()); int i;
/*  349 */     for (i = 0; i < multiTargetForBall.size(); i++) {
/*  350 */       mplew.writeShort(((Short)((Pair)multiTargetForBall.get(i)).left).shortValue());
/*  351 */       mplew.writeShort(((Short)((Pair)multiTargetForBall.get(i)).right).shortValue());
     }

/*  354 */     mplew.write(randTimeForAreaAttack.size());
/*  355 */     for (i = 0; i < randTimeForAreaAttack.size(); i++) {
/*  356 */       mplew.writeShort(((Short)randTimeForAreaAttack.get(i)).shortValue());
     }

/*  359 */     mplew.writeInt(unkV170);

/*  361 */     mplew.write(unkList.size());
/*  362 */     for (i = 0; i < unkList.size(); i++) {
/*  363 */       mplew.writeInt(((Integer)unkList.get(i)).intValue());
     }

/*  366 */     PacketHelper.serializeMovementList(mplew, v169, tEncodedGatherDuration, startPos, velPos, moves);
/*  367 */     mplew.write(0);

/*  369 */     return mplew.getPacket();
   }




   public static byte[] spawnMonster(MapleMonster life, int spawnType, int link) {
/*  376 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  378 */     mplew.writeShort(SendPacketOpcode.SPAWN_MONSTER.getValue());
/*  379 */     mplew.write(0);
/*  380 */     mplew.writeInt(life.getObjectId());
/*  381 */     mplew.write(1);
/*  382 */     mplew.writeInt(life.getId());
/*  383 */     addMonsterStatus(mplew, life);
/*  384 */     EnumMap<MonsterStatus, MonsterStatusEffect> tempStatus = new EnumMap<>(MonsterStatus.class);
/*  385 */     for (MonsterStatus status : MonsterStatus.values()) {
/*  386 */       if (status.isEmpty() && !life.getStati().containsKey(status)) {
/*  387 */         tempStatus.put(status, new MonsterStatusEffect(status, Integer.valueOf(0), 0, null, false));
       }
     }
/*  390 */     tempStatus.putAll((Map<? extends MonsterStatus, ? extends MonsterStatusEffect>)life.getStati());
/*  391 */     writeStatusEffectData(mplew, tempStatus.values());
/*  392 */     writeMonsterEndData(mplew, life, true, spawnType, link);

/*  394 */     return mplew.getPacket();
   }




   public static byte[] controlMonster(MapleMonster life, boolean newSpawn, boolean aggro, int type) {
/*  401 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  403 */     mplew.writeShort(SendPacketOpcode.SPAWN_MONSTER_CONTROL.getValue());
/*  404 */     mplew.write(aggro ? 2 : 1);
/*  405 */     mplew.writeInt(life.getObjectId());
/*  406 */     mplew.write(type);
/*  407 */     mplew.writeInt(life.getId());
/*  408 */     addMonsterStatus(mplew, life);
/*  409 */     writeStatusEffectData(mplew, life.getStati().values());
/*  410 */     writeMonsterEndData(mplew, life, newSpawn, life.isFake() ? 1 : 0, life.getLinkOid());

/*  412 */     return mplew.getPacket();
   }
































































   public static void writeMonsterEndData(MaplePacketLittleEndianWriter mplew, MapleMonster life, boolean newSpawn, int spawnType, int link) {
/*  479 */     mplew.writePos(life.getTruePosition());
/*  480 */     mplew.write(life.getStance());
/*  481 */     if (life.getStats().getSmartPhase() > 0) {
/*  482 */       mplew.write(0);
     }
/*  484 */     int fh = newSpawn ? life.getFh() : life.getMobFH();
/*  485 */     mplew.writeShort(fh);
/*  486 */     mplew.writeShort(life.getFh());
/*  487 */     spawnType = newSpawn ? spawnType : (life.isFake() ? -4 : -1);
/*  488 */     mplew.writeShort(spawnType);
/*  489 */     if (spawnType == -3 || spawnType >= 0) {
/*  490 */       mplew.writeInt(link);
     }
/*  492 */     mplew.write(life.getCarnivalTeam());
/*  493 */     mplew.writeLong((life.getHp() > 2147483647L) ? 2147483647L : life.getMobMaxHp());
/*  494 */     mplew.writeInt(0);
/*  495 */     if (life.getStats().isHasRange()) {
/*  496 */       mplew.writeInt(life.getPatrolScopeX1());
/*  497 */       mplew.writeInt(life.getPatrolScopeX2());
/*  498 */       mplew.writeInt(life.getStats().getDetectX());
/*  499 */       mplew.writeInt(life.getStats().getSenseX());
     }
/*  501 */     mplew.writeInt(0);
/*  502 */     mplew.writeInt(0);
/*  503 */     mplew.writeInt(0);
/*  504 */     mplew.writeInt(0);
/*  505 */     mplew.writeInt(-1);
/*  506 */     mplew.writeInt(0);
/*  507 */     mplew.writeInt(newSpawn ? -1 : 0);

/*  509 */     boolean unk = false;
/*  510 */     mplew.writeBool(unk);
/*  511 */     if (unk) {
/*  512 */       mplew.writeInt(0);
/*  513 */       mplew.writeInt(0);
/*  514 */       mplew.writeInt(0);
     }
/*  516 */     mplew.writeInt(0);

/*  518 */     mplew.writeInt(100);
/*  519 */     mplew.writeInt(life.getEliteGrade());
/*  520 */     if (life.getEliteGrade() > 0) {
/*  521 */       int n4 = 1;
/*  522 */       mplew.writeInt(1);
/*  523 */       for (int j = 0; j < 1; j++) {
/*  524 */         mplew.writeInt(life.getEliteType());
/*  525 */         mplew.writeInt(0);
       }
/*  527 */       mplew.writeInt(life.getEliteType());
     }
/*  529 */     mplew.write(0);
/*  530 */     mplew.write(0);
/*  531 */     mplew.writeInt(0);
/*  532 */     mplew.write(0);
/*  533 */     mplew.writeMapleAsciiString("");
/*  534 */     if (life.getId() == 8880102) {
/*  535 */       mplew.writeInt(life.getFollowChrID());
     }
/*  537 */     mplew.write(0);
/*  538 */     mplew.writeInt(0);
/*  539 */     mplew.write(0);
/*  540 */     mplew.write(0);
/*  541 */     mplew.write(0);
/*  542 */     mplew.writeInt(0);
/*  543 */     mplew.writeInt(0);
/*  544 */     mplew.writeInt(0);
/*  545 */     mplew.writeInt(0);
/*  546 */     mplew.writeInt(0);
/*  547 */     mplew.writeInt(0);
/*  548 */     mplew.write(life.getStats().getHitParts().size());
/*  549 */     for (Map.Entry<String, Integer> entry : (Iterable<Map.Entry<String, Integer>>)life.getStats().getHitParts().entrySet()) {
/*  550 */       mplew.writeMapleAsciiString(entry.getKey());
/*  551 */       mplew.write(0);
/*  552 */       mplew.writeInt(((Integer)entry.getValue()).intValue());
     }
   }
















   public static void addMonsterStatus(MaplePacketLittleEndianWriter mplew, MapleMonster life) {
/*  572 */     if (life.getStati().size() <= 1) {
/*  573 */       life.addEmpty();
     }
/*  575 */     boolean writeChangedStats = (life.getStats().isChangeable() && life.getChangedStats() != null);
/*  576 */     mplew.write(writeChangedStats ? 1 : 0);
/*  577 */     if (writeChangedStats) {

/*  579 */       mplew.writeLong(((life.getChangedStats()).hp > 2147483647L) ? 2147483647L : (int)(life.getChangedStats()).hp);
/*  580 */       mplew.writeInt((life.getChangedStats()).mp);
/*  581 */       mplew.writeInt((life.getChangedStats()).exp);
/*  582 */       mplew.writeInt((life.getChangedStats()).watk);
/*  583 */       mplew.writeInt((life.getChangedStats()).matk);
/*  584 */       mplew.writeInt((life.getChangedStats()).PDRate);
/*  585 */       mplew.writeInt((life.getChangedStats()).MDRate);
/*  586 */       mplew.writeInt((life.getChangedStats()).acc);
/*  587 */       mplew.writeInt((life.getChangedStats()).eva);
/*  588 */       mplew.writeInt((life.getChangedStats()).pushed);
/*  589 */       mplew.writeInt((life.getChangedStats()).speed);
/*  590 */       mplew.writeInt((life.getChangedStats()).level);
/*  591 */       mplew.writeInt(0);
     }
   }


















   public static byte[] stopControllingMonster(int oid) {
/*  613 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  615 */     mplew.writeShort(SendPacketOpcode.SPAWN_MONSTER_CONTROL.getValue());
/*  616 */     mplew.write(0);
/*  617 */     mplew.writeInt(oid);

/*  619 */     return mplew.getPacket();
   }




   public static byte[] makeMonsterReal(MapleMonster life) {
/*  626 */     return spawnMonster(life, -1, 0);
   }

   public static byte[] makeMonsterFake(MapleMonster life) {
/*  630 */     return spawnMonster(life, -4, 0);
   }

   public static byte[] makeMonsterEffect(MapleMonster life, int effect) {
/*  634 */     return spawnMonster(life, effect, 0);
   }








   public static <E extends Buffstat> void writeSingleMask(MaplePacketLittleEndianWriter mplew, E statup) {
/*  645 */     for (int i = 1; i <= 3; i++) {
/*  646 */       mplew.writeInt((i == statup.getPosition()) ? statup.getValue() : 0);
     }
   }








   public static <E extends Buffstat> void writeNewMask(MaplePacketLittleEndianWriter mplew, Collection<E> statups) {
/*  658 */     int[] mask = new int[5];
/*  659 */     for (Buffstat buffstat : statups) {
/*  660 */       mask[buffstat.getPosition()] = mask[buffstat.getPosition()] | buffstat.getValue();
     }
/*  662 */     for (int i = 0; i < mask.length; i++) {
/*  663 */       mplew.writeInt(mask[i]);
     }
   }







   public static void writeMask(MaplePacketLittleEndianWriter mplew, Collection<MonsterStatusEffect> statups) {
/*  674 */     int[] mask = new int[5];
/*  675 */     for (MonsterStatusEffect statup : statups) {
/*  676 */       mask[statup.getStati().getPosition()] = mask[statup.getStati().getPosition()] | statup.getStati().getValue();
     }
/*  678 */     for (int i = 0; i < mask.length; i++) {
/*  679 */       mplew.writeInt(mask[i]);
     }
   }
























   public static byte[] applyMonsterStatus(MapleMonster mons, MonsterStatusEffect ms) {
/*  707 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/*  708 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  710 */     mplew.writeShort(SendPacketOpcode.APPLY_MONSTER_STATUS.getValue());
/*  711 */     mplew.writeInt(mons.getObjectId());
/*  712 */     writeSingleMonsterStatus(mplew, ms);

/*  714 */     return mplew.getPacket();
   }

   public static byte[] applyMonsterStatus(MapleMonster mons, List<MonsterStatusEffect> mss) {
/*  718 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/*  719 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  721 */     mplew.writeShort(SendPacketOpcode.APPLY_MONSTER_STATUS.getValue());
/*  722 */     mplew.writeInt(mons.getObjectId());
/*  723 */     writeMonsterStatusEffectData(mplew, mss);

/*  725 */     return mplew.getPacket();
   }

   public static void writeSingleMonsterStatus(MaplePacketLittleEndianWriter mplew, MonsterStatusEffect ms) {
/*  729 */     List<MonsterStatusEffect> hashSet = new ArrayList<>();
/*  730 */     hashSet.add(ms);
/*  731 */     writeMonsterStatusEffectData(mplew, hashSet);
   }

   public static void writeMonsterStatusEffectData(MaplePacketLittleEndianWriter mplew, Collection<MonsterStatusEffect> collection) {
/*  735 */     writeStatusEffectData(mplew, collection);
/*  736 */     int count = 1;
/*  737 */     for (MonsterStatusEffect mse : collection) {
/*  738 */       if (mse.getCount() <= 1)
/*  739 */         continue;  count = mse.getCount();
     }

/*  742 */     mplew.writeShort(0);
/*  743 */     mplew.write(count + 1);
/*  744 */     mplew.write(count);
   }

































































































































































































































































   public static void writeStatusEffectData(MaplePacketLittleEndianWriter mplew, Collection<MonsterStatusEffect> collection) {
/* 1004 */     HashMap<MonsterStatus, MonsterStatusEffect> hashMap = new HashMap<>();

/* 1006 */     writeMask(mplew, collection);
/* 1007 */     for (MonsterStatusEffect mse : collection) {
/* 1008 */       hashMap.put(mse.getStati(), mse);
/* 1009 */       if (mse.getStati().getOrValue() < MonsterStatus.MOB_STAT_Poison.getOrValue()) {
/* 1010 */         mplew.writeInt(mse.getX().intValue());
/* 1011 */         if (mse.getMobSkill() != null) {
/* 1012 */           mplew.writeShort(mse.getMobSkill().getSkillId());
/* 1013 */           mplew.writeShort(mse.getMobSkill().getSkillLevel());
         } else {
/* 1015 */           mplew.writeInt((mse.getSkill() > 0) ? mse.getSkill() : 0);
         }
/* 1017 */         mplew.writeShort((short)(int)((mse.getCancelTask() - System.currentTimeMillis()) / 500L));
       }
     }
/* 1020 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_PDR)) {
/* 1021 */       mplew.writeInt(0);
     }
/* 1023 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_MDR)) {
/* 1024 */       mplew.writeInt(0);
     }
/* 1026 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_Speed)) {
/* 1027 */       mplew.write(((MonsterStatusEffect)hashMap.get(MonsterStatus.MOB_STAT_Speed)).getCount());
     }
/* 1029 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_Freeze)) {
/* 1030 */       mplew.writeInt(0);
     }
/* 1032 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_PCounter)) {
/* 1033 */       mplew.writeInt(0);
     }
/* 1035 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_MCounter)) {
/* 1036 */       mplew.writeInt(0);
     }
/* 1038 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_PCounter) || hashMap.containsKey(MonsterStatus.MOB_STAT_MCounter)) {
/* 1039 */       mplew.writeInt(500);
/* 1040 */       mplew.write(1);
/* 1041 */       mplew.writeInt(500);
     }
/* 1043 */     if (hashMap.containsKey(MonsterStatus.NEWUNK33)) {
/* 1044 */       mplew.writeInt(0);
/* 1045 */       mplew.writeInt(0);
/* 1046 */       mplew.writeInt(0);
     }
/* 1048 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_AddDamParty)) {
/* 1049 */       mplew.writeInt(0);
/* 1050 */       mplew.writeInt(0);
/* 1051 */       mplew.writeInt(999999);
     }

/* 1054 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_Fatality)) {
/* 1055 */       mplew.writeInt(((MonsterStatusEffect)hashMap.get(MonsterStatus.MOB_STAT_Fatality)).getFromID());
/* 1056 */       mplew.writeInt(0);
/* 1057 */       mplew.writeInt(2 * ((MonsterStatusEffect)hashMap.get(MonsterStatus.MOB_STAT_Fatality)).getX().intValue() / 3);
/* 1058 */       mplew.writeInt(0);
     }

/* 1061 */     if (hashMap.containsKey(MonsterStatus.NEWUNK48)) {
/* 1062 */       mplew.writeInt(0);
     }

/* 1065 */     if (hashMap.containsKey(MonsterStatus.UNK82)) {
/* 1066 */       mplew.writeInt(0);
     }
/* 1068 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_ElementDarkness)) {
/* 1069 */       mplew.writeInt(0);
     }

/* 1072 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_DeadlyCharge)) {
/* 1073 */       mplew.writeInt(0);
/* 1074 */       mplew.writeInt(0);
     }
/* 1076 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_Incizing)) {
/* 1077 */       mplew.writeInt(0);
/* 1078 */       mplew.writeInt(0);
/* 1079 */       mplew.writeInt(0);
     }





/* 1086 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_BMageDebuff)) {
/* 1087 */       mplew.writeInt(0);
     }
/* 1089 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_DarkLightning)) {
/* 1090 */       mplew.writeInt(0);
     }
/* 1092 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_BattlePvP_Helena_Mark)) {
/* 1093 */       mplew.writeInt(0);
     }
/* 1095 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_MultiPMDR)) {
/* 1096 */       mplew.writeInt(0);
     }
/* 1098 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_ElementResetBySummon)) {
/* 1099 */       mplew.writeInt(0);
/* 1100 */       mplew.writeInt(0);
/* 1101 */       mplew.writeInt(0);
/* 1102 */       mplew.writeInt(0);
     }
/* 1104 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_BahamutLightElemAddDam)) {
/* 1105 */       mplew.writeInt(0);
/* 1106 */       mplew.writeInt(0);
     }
/* 1108 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_MultiDamSkill)) {
/* 1109 */       mplew.writeInt(((MonsterStatusEffect)hashMap.get(MonsterStatus.MOB_STAT_MultiDamSkill)).getFromID());
     }
/* 1111 */     if (hashMap.containsKey(MonsterStatus.CurseMark)) {
/* 1112 */       mplew.writeInt(4);
/* 1113 */       mplew.writeInt(0);
/* 1114 */       mplew.writeInt(0);
     }
/* 1116 */     if (hashMap.containsKey(MonsterStatus.Ticktock)) {
/* 1117 */       mplew.writeInt(0);
     }
/* 1119 */     if (hashMap.containsKey(MonsterStatus.UNK78)) {
/* 1120 */       mplew.writeInt(0);
     }

/* 1123 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_T156Unk12)) {
/* 1124 */       mplew.writeInt(0);
     }
/* 1126 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_Ambush)) {
/* 1127 */       mplew.writeInt(0);
     }
/* 1129 */     if (hashMap.containsKey(MonsterStatus.UNK83)) {
/* 1130 */       mplew.writeInt(0);
     }
/* 1132 */     if (hashMap.containsKey(MonsterStatus.UNK85)) {
/* 1133 */       mplew.writeInt(0);
     }
/* 1135 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_Explosion)) {
/* 1136 */       mplew.writeInt(0);
     }
/* 1138 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_Poison)) {
/* 1139 */       int n2 = (((MonsterStatusEffect)hashMap.get(MonsterStatus.MOB_STAT_Poison)).getX().intValue() > 0) ? 1 : 0;
/* 1140 */       int n3 = 1;
/* 1141 */       mplew.write(n2);
/* 1142 */       if (n2 > 0) {

         do {
/* 1145 */           MonsterStatusEffect ms = hashMap.get(MonsterStatus.MOB_STAT_Poison);

/* 1147 */           mplew.writeInt(ms.getFromID());
/* 1148 */           mplew.writeInt(0);
/* 1149 */           mplew.writeInt(ms.getSkill());
/* 1150 */           mplew.writeLong(ms.getX().intValue());
/* 1151 */           mplew.writeInt(1000);
/* 1152 */           mplew.writeInt(0);
/* 1153 */           mplew.writeInt(10000);
/* 1154 */           mplew.writeInt((int)(ms.getDotTime() / 1000L));
/* 1155 */           mplew.writeInt(0);
/* 1156 */           mplew.writeInt(0);
/* 1157 */           mplew.writeInt(0);
/* 1158 */           mplew.writeInt(0);
/* 1159 */           mplew.writeInt(999999);
/* 1160 */           mplew.writeInt(0);
/* 1161 */           mplew.writeInt(0);
/* 1162 */           mplew.writeInt(ms.getX().intValue());
/* 1163 */         } while (++n3 < n2);
       }
     }
























/* 1190 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_BalogDisable)) {
/* 1191 */       mplew.write(0);
/* 1192 */       mplew.write(0);
     }
/* 1194 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_ExchangeAttack)) {
/* 1195 */       mplew.write(0);
     }


/* 1199 */     boolean unkAddBuffStat = true;
/* 1200 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_AddBuffStat)) {
/* 1201 */       if (unkAddBuffStat) {
/* 1202 */         mplew.writeBool(unkAddBuffStat);
/* 1203 */         mplew.writeInt(0);
/* 1204 */         mplew.writeInt(0);
/* 1205 */         mplew.writeInt(0);
/* 1206 */         mplew.writeInt(0);
       } else {
/* 1208 */         mplew.writeBool(unkAddBuffStat);
       }
     }


/* 1213 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_LinkTeam)) {
/* 1214 */       mplew.writeMapleAsciiString("");
     }
/* 1216 */     if (hashMap.containsKey(MonsterStatus.NEWUNK108)) {
/* 1217 */       mplew.writeInt(0);
     }
/* 1219 */     if (hashMap.containsKey(MonsterStatus.NEWUNK109)) {
/* 1220 */       mplew.writeLong(0L);
     }

/* 1223 */     if (hashMap.containsKey(MonsterStatus.NEWUNK114)) {
/* 1224 */       mplew.write(0);
     }
/* 1226 */     if (hashMap.containsKey(MonsterStatus.NEWUNK110)) {
/* 1227 */       mplew.writeInt(0);
     }
/* 1229 */     if (hashMap.containsKey(MonsterStatus.NEWUNK111)) {
/* 1230 */       mplew.writeInt(0);
     }
/* 1232 */     if (hashMap.containsKey(MonsterStatus.NEWUNK112)) {
/* 1233 */       mplew.writeInt(0);
     }
/* 1235 */     if (hashMap.containsKey(MonsterStatus.NEWUNK113)) {
/* 1236 */       mplew.writeInt(0);
     }



/* 1241 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_SoulExplosion)) {
/* 1242 */       mplew.writeInt(0);
/* 1243 */       mplew.writeInt(0);
/* 1244 */       mplew.writeInt(0);
     }
/* 1246 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_SeperateSoulP)) {
/* 1247 */       MonsterStatusEffect ms = hashMap.get(MonsterStatus.MOB_STAT_SeperateSoulP);
/* 1248 */       mplew.writeInt((ms != null) ? ms.getX().intValue() : 0);
/* 1249 */       mplew.writeInt((ms != null) ? ms.getMoboid() : 0);
/* 1250 */       mplew.writeShort(0);
/* 1251 */       mplew.writeInt((ms != null) ? ms.getX().intValue() : 0);
/* 1252 */       mplew.writeInt((ms != null) ? ms.getSkill() : 0);
     }
/* 1254 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_SeperateSoulC)) {
/* 1255 */       MonsterStatusEffect ms = hashMap.get(MonsterStatus.MOB_STAT_SeperateSoulC);
/* 1256 */       mplew.writeInt((ms != null) ? ms.getX().intValue() : 0);
/* 1257 */       mplew.writeInt((ms != null) ? ms.getMoboid() : 0);
/* 1258 */       mplew.writeShort(0);
/* 1259 */       mplew.writeInt((ms != null) ? ms.getCount() : 0);
     }
/* 1261 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_Ember)) {
/* 1262 */       mplew.writeInt(0);
/* 1263 */       mplew.writeInt(0);
/* 1264 */       mplew.writeInt(0);
/* 1265 */       mplew.writeInt(0);
/* 1266 */       mplew.writeInt(0);
     }
/* 1268 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_TrueSight)) {
/* 1269 */       mplew.writeInt(0);
/* 1270 */       mplew.writeInt(0);
/* 1271 */       mplew.writeInt(((MonsterStatusEffect)hashMap.get(MonsterStatus.MOB_STAT_TrueSight)).getX().intValue());
/* 1272 */       mplew.writeInt(((MonsterStatusEffect)hashMap.get(MonsterStatus.MOB_STAT_TrueSight)).getSkill());
/* 1273 */       mplew.writeInt((((MonsterStatusEffect)hashMap.get(MonsterStatus.MOB_STAT_TrueSight)).getSkill() > 0) ? (int)System.currentTimeMillis() : 0);
/* 1274 */       mplew.writeInt(0);
/* 1275 */       mplew.writeInt(0);
     }

/* 1278 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_Laser)) {

/* 1280 */       boolean existing = (((MonsterStatusEffect)hashMap.get(MonsterStatus.MOB_STAT_Laser)).getX().intValue() != 0);

/* 1282 */       int LaserTime = (int)((System.currentTimeMillis() - ((MonsterStatusEffect)hashMap.get(MonsterStatus.MOB_STAT_Laser)).getStartTime()) / 1100.0D * 10.0D % 360.0D);
/* 1283 */       mplew.writeInt(existing ? ((MonsterStatusEffect)hashMap.get(MonsterStatus.MOB_STAT_Laser)).getX().intValue() : 0);
/* 1284 */       mplew.writeShort(existing ? ((MonsterStatusEffect)hashMap.get(MonsterStatus.MOB_STAT_Laser)).getMobSkill().getSkillId() : 0);
/* 1285 */       mplew.writeShort(existing ? ((MonsterStatusEffect)hashMap.get(MonsterStatus.MOB_STAT_Laser)).getMobSkill().getSkillLevel() : 0);
/* 1286 */       mplew.writeInt(existing ? DateUtil.getTime() : 0);
/* 1287 */       mplew.writeInt((existing && !((MonsterStatusEffect)hashMap.get(MonsterStatus.MOB_STAT_Laser)).isFirstUse()) ? 1 : 0);
/* 1288 */       mplew.writeInt(existing ? LaserTime : 0);
     }

/* 1291 */     if (hashMap.containsKey(MonsterStatus.NEWUNK107)) {
/* 1292 */       mplew.writeInt(0);
/* 1293 */       mplew.writeInt(0);
/* 1294 */       mplew.writeInt(0);
     }

/* 1297 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_COUNT)) {
/* 1298 */       mplew.writeInt(0);
     }

/* 1301 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_ElementDarkness)) {
/* 1302 */       mplew.writeInt(0);
     }

/* 1305 */     if (hashMap.containsKey(MonsterStatus.MOB_STAT_Unk1)) {
/* 1306 */       mplew.writeInt(0);
/* 1307 */       mplew.writeInt(0);
     }
   }


   public static byte[] applyNewMonsterStatus(MapleMonster monster, List<Pair<MonsterStatus, NewMonsterStatusEffect>> statups) {
    log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.writeShort(SendPacketOpcode.APPLY_MONSTER_STATUS.getValue());
    mplew.writeInt(monster.getObjectId());
    writeNewMask(mplew, statups.stream().map(Pair::getLeft).collect(Collectors.toList()));
    for (Pair<MonsterStatus, NewMonsterStatusEffect> statup : statups) {
        mplew.writeInt(statup.getRight().getX());
        mplew.writeInt(statup.getRight().getSkillid());
        mplew.writeShort(0);
    }
    mplew.writeShort(0);
    mplew.writeZeroBytes(statups.size() * 2);
    mplew.writeZeroBytes(5);
    mplew.write(0);
    mplew.write(1);
    mplew.write(1);

    return mplew.getPacket();
   }

   public static byte[] cancelMonsterStatus(MapleMonster monster, MonsterStatusEffect mse) {
/* 1335 */     List<MonsterStatusEffect> arrayList = new ArrayList<>();
/* 1336 */     arrayList.add(mse);
/* 1337 */     return cancelMonsterStatus(monster, arrayList);
   }

   public static byte[] cancelMonsterStatus(MapleMonster monster, List<MonsterStatusEffect> statups) {
/* 1341 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 1342 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1344 */     mplew.writeShort(SendPacketOpcode.CANCEL_MONSTER_STATUS.getValue());
/* 1345 */     mplew.writeInt(monster.getObjectId());
/* 1346 */     writeMask(mplew, statups);
/* 1347 */     for (MonsterStatusEffect mse : statups) {
/* 1348 */       if (mse.getStati() == MonsterStatus.MOB_STAT_Poison) {
/* 1349 */         mplew.writeInt(statups.size());
/* 1350 */         mplew.writeInt(1);
/* 1351 */         for (int i = 1; i > 0; i--) {
/* 1352 */           mplew.writeInt(mse.getFromID());
/* 1353 */           mplew.writeInt(mse.getSkill());
/* 1354 */           mplew.writeInt(mse.GetStack());
         }
       }
     }
/* 1358 */     mplew.write(5);
/* 1359 */     mplew.write(0);

/* 1361 */     return mplew.getPacket();
   }

   public static byte[] cancelMonsterStatus(int oid, List<MonsterStatus> statups) {
/* 1365 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 1366 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1368 */     mplew.writeShort(SendPacketOpcode.CANCEL_MONSTER_STATUS.getValue());
/* 1369 */     mplew.writeInt(oid);

/* 1371 */     writeNewMask(mplew, statups);

/* 1373 */     mplew.write(1);
/* 1374 */     mplew.write(1);

/* 1376 */     return mplew.getPacket();
   }















































































































































   public static byte[] showResults(int mobid, boolean success) {
/* 1522 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 1523 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1525 */     mplew.writeShort(SendPacketOpcode.SHOW_RESULTS.getValue());
/* 1526 */     mplew.writeInt(mobid);
/* 1527 */     mplew.writeBool(success);
/* 1528 */     mplew.write(1);

/* 1530 */     return mplew.getPacket();
   }




   public static byte[] catchMonster(int mobid, int itemid, byte success) {
/* 1537 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 1538 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1540 */     mplew.writeShort(SendPacketOpcode.CATCH_MONSTER.getValue());
/* 1541 */     mplew.writeInt(mobid);
/* 1542 */     mplew.writeInt(itemid);
/* 1543 */     mplew.write(success);

/* 1545 */     return mplew.getPacket();
   }

   public static byte[] unknown(int moboid) {
/* 1549 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 1550 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1552 */     mplew.writeShort(969);
/* 1553 */     mplew.writeLong(moboid);

/* 1555 */     return mplew.getPacket();
   }

   public static byte[] showMobSkillDelay(int moboid, MobSkill mobSkill, int effectAfter, List<Rectangle> rectangles) {
/* 1559 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 1560 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1562 */     mplew.writeShort(SendPacketOpcode.MONSTER_SKILL_DELAY.getValue());
/* 1563 */     mplew.writeInt(moboid);
/* 1564 */     mplew.writeInt(effectAfter);
/* 1565 */     mplew.writeInt(mobSkill.getSkillId());
/* 1566 */     mplew.writeInt(mobSkill.getSkillLevel());
/* 1567 */     mplew.writeInt(mobSkill.getAreaSequenceDelay());
/* 1568 */     mplew.writeInt(0);
/* 1569 */     mplew.writeInt(rectangles.size());
/* 1570 */     rectangles.forEach(mplew::writeRect);

/* 1572 */     return mplew.getPacket();
   }

   public static byte[] showMonsterSpecialSkill(int moboid, int type) {
/* 1576 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 1577 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1579 */     mplew.writeShort(SendPacketOpcode.MONSTER_FORCED_SKILL_ACTION.getValue());
/* 1580 */     mplew.writeInt(moboid);
/* 1581 */     mplew.writeInt(type);
/* 1582 */     mplew.write(0);

/* 1584 */     return mplew.getPacket();
   }

   public static byte[] MobEscortStopSay(int oid, int chatBalloon, int time, String string, int type) {
/* 1588 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1590 */     mplew.writeShort(SendPacketOpcode.MONSTER_ESCORT_STOP_SAY.getValue());
/* 1591 */     mplew.writeInt(oid);
/* 1592 */     mplew.writeInt(time);
/* 1593 */     mplew.writeInt(chatBalloon);
/* 1594 */     mplew.write((chatBalloon < 100000) ? 0 : 1);
/* 1595 */     mplew.write((string == null || string.length() <= 0) ? 0 : 1);
/* 1596 */     if (string != null && string.length() > 0) {
/* 1597 */       mplew.writeMapleAsciiString(string);
     }
/* 1599 */     mplew.writeInt(type);

/* 1601 */     return mplew.getPacket();
   }

   public static byte[] MobEscortStopEndPermmision(int oid) {
/* 1605 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1607 */     mplew.writeShort(SendPacketOpcode.MONSTER_ESCORT_STOP_END_PERMMISION.getValue());
/* 1608 */     mplew.writeInt(oid);

/* 1610 */     return mplew.getPacket();
   }

   public static byte[] mobEscortReturnBefore(MapleMonster mob, MapleMap map) {
/* 1614 */     if (mob.getNodePacket() != null) {
/* 1615 */       return mob.getNodePacket();
     }
/* 1617 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/* 1618 */     mplew.writeShort(SendPacketOpcode.MONSTER_REQUEST_RESULT_ESCORT_INFO.getValue());
/* 1619 */     mplew.writeInt(mob.getObjectId());
/* 1620 */     mplew.writeInt(map.getNodes().size());
/* 1621 */     mplew.writeInt((mob.getPosition()).x);
/* 1622 */     mplew.writeInt((mob.getPosition()).y);
/* 1623 */     for (MapleNodes.MapleNodeInfo nodeInfo : map.getNodes()) {
/* 1624 */       mplew.writeInt(nodeInfo.x);
/* 1625 */       mplew.writeInt(nodeInfo.y);
/* 1626 */       mplew.writeInt(nodeInfo.attr);
/* 1627 */       if (nodeInfo.attr != 2)
/* 1628 */         continue;  mplew.writeInt(500);
     }
/* 1630 */     mplew.writeZeroBytes(6);
/* 1631 */     mob.setNodePacket(mplew.getPacket());
/* 1632 */     return mob.getNodePacket();
   }

   public static byte[] mobEscortStopEndPermmision(int oid) {
/* 1636 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1638 */     mplew.writeShort(SendPacketOpcode.MONSTER_REQUEST_RESULT_ESCORT_INFO.getValue());
/* 1639 */     mplew.writeInt(oid);

/* 1641 */     return mplew.getPacket();
   }

   public static byte[] getBossHatred(Map<String, Integer> aggroRank) {
/* 1645 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1647 */     mplew.writeShort(SendPacketOpcode.BOSS_HATRED.getValue());
/* 1648 */     ArrayList<Map.Entry<String, Integer>> list = new ArrayList<>(aggroRank.entrySet());
/* 1649 */     list.sort((entry, entry2) -> ((Integer)entry2.getValue()).intValue() - ((Integer)entry.getValue()).intValue());
/* 1650 */     mplew.writeInt(list.size());
/* 1651 */     list.forEach(entry3 -> mplew.writeMapleAsciiString((String)entry3.getKey()));

/* 1653 */     return mplew.getPacket();
   }

   public static byte[] showMonsterNotice(int chrid, int type, String message) {
/* 1657 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1659 */     mplew.writeShort(SendPacketOpcode.MONSTER_NOTICE_MESSAGE.getValue());
/* 1660 */     mplew.writeInt(Randomizer.nextInt(3));
/* 1661 */     mplew.writeInt(chrid);
/* 1662 */     mplew.writeInt(type);
/* 1663 */     mplew.writeInt(0);
/* 1664 */     mplew.writeMapleAsciiString(message);

/* 1666 */     return mplew.getPacket();
   }

   public static byte[] controlLaser(int moboid, int angle, int x, boolean isFirstUse) {
/* 1670 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1672 */     mplew.writeShort(SendPacketOpcode.MONSTER_LASER_CONTROL.getValue());
/* 1673 */     mplew.writeInt(moboid);
/* 1674 */     mplew.writeInt(angle);
/* 1675 */     mplew.writeInt(x);
/* 1676 */     mplew.writeBool(isFirstUse);

/* 1678 */     return mplew.getPacket();
   }

   public static byte[] showMonsterPhaseChange(int moid, int reduceDamageType) {
/* 1682 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1684 */     mplew.writeShort(SendPacketOpcode.MONSTER_PHASE_CHANGE.getValue());
/* 1685 */     mplew.writeInt(moid);
/* 1686 */     mplew.writeInt(reduceDamageType);
/* 1687 */     mplew.write(1);

/* 1689 */     return mplew.getPacket();
   }

   public static byte[] changeMonsterZone(int moid, int reduceDamageType) {
/* 1693 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1695 */     mplew.writeShort(SendPacketOpcode.MONSTER_ZONE_CHANGE.getValue());
/* 1696 */     mplew.writeInt(moid);
/* 1697 */     mplew.writeInt(reduceDamageType);

/* 1699 */     return mplew.getPacket();
   }

   public static byte[] MonsterDemianDelayedAttackCreate(int moboid, int skilllevel, Map<Integer, Point> pointMap, boolean isFacingLeft) {
/* 1703 */     return MonsterDemianDelayedAttackCreate(moboid, 42, skilllevel, 0, null, pointMap, isFacingLeft);
   }

   public static byte[] a(int moboid, int skilllevel, int n3, int n4, Point point, boolean isFacingLeft) {
/* 1707 */     return a(moboid, skilllevel, n3, n4, point, null, isFacingLeft);
   }

   public static byte[] a(int moboid, int skilllevel, int n3, int n4, Point point, Map<Integer, Point> pointMap, boolean isFacingLeft) {
/* 1711 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1713 */     mplew.writeShort(SendPacketOpcode.MONSTER_DEMIAN_DELAYED_ATTACK_CREATE.getValue());
/* 1714 */     mplew.writeInt(moboid);
/* 1715 */     mplew.writeInt(170);
/* 1716 */     mplew.writeInt(skilllevel);
/* 1717 */     if (skilllevel == 42) {
/* 1718 */       mplew.writeBool(isFacingLeft);
/* 1719 */       mplew.writeInt(n3);
/* 1720 */       mplew.writeInt(pointMap.size());
/* 1721 */       for (Map.Entry<Integer, Point> entry : pointMap.entrySet()) {
/* 1722 */         a(mplew, ((Integer)entry.getKey()).intValue(), entry.getValue());
/* 1723 */         mplew.writeInt(Randomizer.rand(73, 95));
       }
/* 1725 */     } else if (skilllevel > 44 && skilllevel <= 47) {
/* 1726 */       mplew.writeBool(isFacingLeft);
/* 1727 */       mplew.writeInt(n3);
/* 1728 */       a(mplew, n4, point);
     }

/* 1731 */     return mplew.getPacket();
   }

   public static void a(MaplePacketLittleEndianWriter mplew, int n, Point point) {
/* 1735 */     mplew.writeInt(n);
/* 1736 */     mplew.writeInt(point.x);
/* 1737 */     mplew.writeInt(point.y);
   }




   public static byte[] teleportMonster(int moboid, boolean b, int x, Point point, int n3) {
/* 1744 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1746 */     mplew.writeShort(SendPacketOpcode.MONSTER_TELEPORT.getValue());
/* 1747 */     mplew.writeInt(moboid);
/* 1748 */     mplew.writeBool(b);
/* 1749 */     if (!b) {
/* 1750 */       mplew.writeInt(x);
/* 1751 */       switch (x) {
         case 3:
         case 5:
         case 6:
         case 7:
         case 8:
         case 9:
         case 10:
         case 11:
         case 12:
         case 100:
/* 1762 */           mplew.writeInt(point.x);
/* 1763 */           mplew.writeInt(point.y);
           break;

         case 4:
/* 1767 */           mplew.writeInt(n3);
           break;
       }


     }
/* 1773 */     return mplew.getPacket();
   }

   public static byte[] MonsterDemianDelayedAttackCreate(int moboid, int skilllevel, int n3, int n, Point point, boolean isFacingLeft) {
/* 1777 */     return MonsterDemianDelayedAttackCreate(moboid, skilllevel, n3, n, point, null, isFacingLeft);
   }

   public static byte[] MonsterDemianDelayedAttackCreate(int moboid, int skilllevel, int n3, int n, Point point, Map<Integer, Point> pointMap, boolean isFacingLeft) {
/* 1781 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1783 */     mplew.writeShort(SendPacketOpcode.MONSTER_DEMIAN_DELAYED_ATTACK_CREATE.getValue());
/* 1784 */     mplew.writeInt(moboid);
/* 1785 */     mplew.writeInt(170);
/* 1786 */     mplew.writeInt(skilllevel);
/* 1787 */     if (skilllevel == 42) {
/* 1788 */       mplew.writeBool(isFacingLeft);
/* 1789 */       mplew.writeInt(n3);
/* 1790 */       mplew.writeInt(pointMap.size());
/* 1791 */       for (Map.Entry<Integer, Point> entry : pointMap.entrySet()) {
/* 1792 */         PointInfo(mplew, ((Integer)entry.getKey()).intValue(), entry.getValue());
/* 1793 */         mplew.writeInt(Randomizer.rand(73, 95));
       }
/* 1795 */     } else if (skilllevel > 44 && skilllevel <= 47) {
/* 1796 */       mplew.writeBool(isFacingLeft);
/* 1797 */       mplew.writeInt(n3);
/* 1798 */       PointInfo(mplew, n, point);
     }

/* 1801 */     return mplew.getPacket();
   }

   public static void PointInfo(MaplePacketLittleEndianWriter mplew, int n, Point point) {
/* 1805 */     mplew.writeInt(n);
/* 1806 */     mplew.writeInt(point.x);
/* 1807 */     mplew.writeInt(point.y);
   }

   public static byte[] cancelMonsterAction(MapleMonster monster, int n) {
/* 1811 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1813 */     mplew.writeShort(SendPacketOpcode.CANCEL_MONSTER_ACTION.getValue());
/* 1814 */     mplew.writeInt(monster.getObjectId());
/* 1815 */     mplew.write(n);

/* 1817 */     return mplew.getPacket();
   }

   public static byte[] CreateDemianFlyingSword(boolean bl2, int monsterOid, int nodeid, Point point) {
/* 1821 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1823 */     mplew.writeShort(SendPacketOpcode.DEMIAN_FLYING_SWORD_CREATE.getValue());
/* 1824 */     mplew.writeBool(bl2);
/* 1825 */     if (bl2) {
/* 1826 */       mplew.writeInt(monsterOid);
/* 1827 */       mplew.write(0);
/* 1828 */       mplew.write(4);
/* 1829 */       mplew.writeInt(nodeid);
/* 1830 */       mplew.writeInt(point.x);
/* 1831 */       mplew.writeInt(point.y);
     } else {
/* 1833 */       mplew.writeInt(monsterOid);
     }

/* 1836 */     return mplew.getPacket();
   }

   public static byte[] NodeDemianFlyingSword(int n2, boolean bl2, MapleSwordNode node) {
/* 1840 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1842 */     mplew.writeShort(SendPacketOpcode.DEMIAN_FLYING_SWORD_NODE.getValue());
/* 1843 */     mplew.writeInt(n2);
/* 1844 */     mplew.writeInt(node.getBKM());
/* 1845 */     mplew.writeBool(bl2);
/* 1846 */     mplew.writeInt(node.getSwordNodeInfos().size());
/* 1847 */     for (MapleSwordNode.MapleSwordNodeInfo a2 : node.getSwordNodeInfos()) {
/* 1848 */       mplew.write(a2.getNodeType());
/* 1849 */       mplew.writeShort(a2.getBKS());
/* 1850 */       mplew.writeShort(a2.getNodeIndex());
/* 1851 */       mplew.writeShort(a2.getBKU());
/* 1852 */       mplew.writeInt(a2.getBKV());
/* 1853 */       mplew.writeInt(a2.getBKW());
/* 1854 */       mplew.writeInt(a2.getBKX());
/* 1855 */       mplew.write(a2.getBKZ());
/* 1856 */       mplew.write(a2.getBKY());
/* 1857 */       mplew.writeInt((a2.getPos()).x);
/* 1858 */       mplew.writeInt((a2.getPos()).y);
     }

/* 1861 */     return mplew.getPacket();
   }

   public static byte[] TargetDemianFlyingSword(int n2, int n3) {
/* 1865 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1867 */     mplew.writeShort(SendPacketOpcode.DEMIAN_FLYING_SWORD_TARGET.getValue());
/* 1868 */     mplew.writeInt(n2);
/* 1869 */     mplew.writeInt(n3);

/* 1871 */     return mplew.getPacket();
   }

   public static byte[] LockChainAttack(MapleMonster monster) {
/* 1875 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1877 */     mplew.writeShort(SendPacketOpcode.LOCKCHAIN_ATTACK.getValue());
/* 1878 */     mplew.writeInt((monster.getTruePosition()).x);
/* 1879 */     mplew.writeInt((monster.getTruePosition()).y);

/* 1881 */     return mplew.getPacket();
   }

   public static byte[] BlackJacketResult(MapleMonster monster, int skills) {
/* 1885 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1887 */     mplew.writeShort(SendPacketOpcode.BLACK_JACKET_RESULT.getValue());
/* 1888 */     mplew.writeInt(skills);
/* 1889 */     mplew.writeInt(1);
/* 1890 */     mplew.writeInt(1);
/* 1891 */     mplew.writeInt((monster.getTruePosition()).x);
/* 1892 */     mplew.writeInt((monster.getTruePosition()).y);

/* 1894 */     return mplew.getPacket();
   }




   public static byte[] AllArrowLaunch(int oid, int arrow) {
/* 1901 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1903 */     mplew.writeShort(SendPacketOpcode.ALL_ARROW_LAUNCH.getValue());
/* 1904 */     mplew.writeInt(oid);
/* 1905 */     mplew.writeInt(arrow);

/* 1907 */     return mplew.getPacket();
   }

   public static byte[] summonUseSkill(MapleMonster monster, int skill, MapleCharacter player) {
/* 1911 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1913 */     mplew.writeShort(SendPacketOpcode.SUMMON_USE_SKILL.getValue());
/* 1914 */     mplew.writeInt(monster.getObjectId());
/* 1915 */     mplew.writeInt(skill);
/* 1916 */     mplew.writeInt(player.getId());
/* 1917 */     mplew.write(player.getLevel());
/* 1918 */     mplew.write(3);

/* 1920 */     return mplew.getPacket();
   }

   public static byte[] OnMobSetAfterAttack(int oid, int AfterAttack, int nAction, boolean IsLeft) {
/* 1924 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();








/* 1933 */     mplew.writeShort(SendPacketOpcode.MOB_SET_AFTERATTACK.getValue());
/* 1934 */     mplew.writeInt(oid);
/* 1935 */     mplew.writeShort(AfterAttack);

/* 1937 */     mplew.writeInt(1);
/* 1938 */     mplew.writeInt(nAction);
/* 1939 */     mplew.writeBool(IsLeft);

/* 1941 */     return mplew.getPacket();
   }

   public static byte[] MobSkillDelay(int objectId, int skillID, int skillLv, int skillAfter, short sequenceDelay, List<Rectangle> skillRectInfo) {
/* 1945 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 1947 */     mplew.writeShort(SendPacketOpcode.MONSTER_SKILL_DELAY.getValue());
/* 1948 */     mplew.writeInt(objectId);
/* 1949 */     mplew.writeInt(skillAfter);
/* 1950 */     mplew.writeInt(skillID);
/* 1951 */     mplew.writeInt(skillLv);
/* 1952 */     mplew.writeInt(0);
/* 1953 */     if (skillRectInfo == null || skillRectInfo.isEmpty()) {
/* 1954 */       mplew.writeInt(0);
/* 1955 */       mplew.writeInt(0);
     } else {
/* 1957 */       mplew.writeInt(sequenceDelay);
/* 1958 */       mplew.writeInt(skillRectInfo.size());
/* 1959 */       for (Rectangle rect : skillRectInfo) {
/* 1960 */         mplew.writeInt(rect.x);
/* 1961 */         mplew.writeInt(rect.y);
/* 1962 */         mplew.writeInt(rect.x + rect.width);
/* 1963 */         mplew.writeInt(rect.y + rect.height);
       }
     }
/* 1966 */     return mplew.getPacket();
   }
 }


/* Location:              C:\PGX\Server.jar!\tools\packet\MobPacket.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */